import React from 'react';
import { Button, message, Form, Input ,Upload, Icon, } from 'antd';
import {useNavigate} from 'react-router-dom';
export default function UploadUser(){
	const navigate = useNavigate();
	const formItemLayout = {
	      labelCol: { span: 6 }, 
	      wrapperCol: { span: 14 },
	    };
	const normFile = (e) => {
		    console.log('Upload event:', e);
		    if (Array.isArray(e)) {
		      return e;
		    }
		    return e && e.fileList;
		  }
    const onFinish = (values) => {
        Object.getOwnPropertyNames(obj);
	};
	
	const onFinishFailed = (errorInfo) => {
	  console.log('Failed:', errorInfo);
	};
	return (<div><Form
	  name="basic"
	  labelCol={{ span: 8 }}
	  wrapperCol={{ span: 16 }}
	  style={{ Width: 400 }}
	  initialValues={{ remember: true }}
	  onFinish={onFinish}
	  onFinishFailed={onFinishFailed}
	  autoComplete="off"
	>
	  <Form.Item
	    label={<div style={{color:'white'}}>用户名</div>}
	    name="account"
	    rules={[{ required: true, message: '请输入账户名!' }]}
	  >
	    <Input placeholder="请输入账户名"/>
	  </Form.Item>
	
	  <Form.Item
	    label={<div style={{color:'white'}}>角色</div>}
	    name="userGroup"
	    rules={[{ required: true, message: '请输入橘色!' }]}
	  >
	    <Input />
	  </Form.Item>
	   <Form.Item
	            {...formItemLayout}
	            label="头像"
	          >
	            {getFieldDecorator('upload', {
	              valuePropName: 'fileList',
	              getValueFromEvent: normFile,
	            })(
	              <Upload name="logo" action="/upload.do" listType="picture">
	                <Button>
	                  <Icon type="upload" /> 点击上传
	                </Button>
	              </Upload>
	            )}
	          </Form.Item>
	  <Form.Item wrapperCol={{ offset: 8, span: 16 }}>
	    <Button type="primary" htmlType="submit">
	      保存
	    </Button>
	  </Form.Item>
	</Form></div>)
}
